package tpenchere.application;
import javax.swing.JDialog;
import javax.swing.JFrame;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

import tpenchere.ui.MainWindow;
import tpenchere.ui.AbstractView.ViewType;
//tpenchere.application.MainApplication
public class MainApplication extends SingleFrameApplication  {
	
	MainWindow mainWindow;
	

	
	public static MainApplication getApplication() {
		return Application.getInstance(MainApplication.class);
	}
	
	public MainWindow getMainWindow() {
        return mainWindow;
    }
	
	/**
     * This method is to initialize the specified window by injecting resources. Windows shown in our application come fully initialized from the GUI builder, so this additional configuration is not
     * needed.
     */
    @Override
    protected void configureWindow(java.awt.Window pRoot) {
        pRoot.setSize(506, 275);
    }
	
	/**
     * At startup create and show the main frame of the application.
     */
	@Override
	protected void startup() {
		// TODO Auto-generated method stub
		// for lookAndFeel specific window decoration
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);

        mainWindow = new MainWindow(this);
        mainWindow.switchToView(ViewType.LOGIN);
        show(mainWindow);
	}
	
	/**
     * Method to perform shutdown tasks
     * 
     * @see org.jdesktop.application.SingleFrameApplication#shutdown()
     */
    @Override
    protected void shutdown() {
        // The default shutdown (super) saves session window state.
        super.shutdown();
        // Now perform any other shutdown tasks you need.
    }
}
